package com.leapp.sk.viewdelegate.personal

import android.support.v7.app.AppCompatActivity
import android.text.TextUtils
import android.widget.TextView
import cc.vv.lkbasecomponent.util.LKSystemUtil
import com.example.mvp.delegate.BaseAppDelegate
import com.example.mvp.view.SKTopBar
import com.leapp.sk.R
import com.leapp.sk.ui.activity.personal.ContactCustomerServiceActivity
import com.leapp.sk.ui.activity.personal.ContactTecherActivity

/**
 * 联系客服视图托管类
 * @author  chaohaipeng  on 2018/8/8.
 */
class ContactCustomerServiceDelegate : BaseAppDelegate(){
    override fun initWidget() {

    }

    override fun initLayoutRes(): Int {
        return R.layout.activity_contact_custom_service
    }

   fun setVersion(){
       val tv_accs_version = getView<TextView>(R.id.tv_accs_version)
       tv_accs_version.text=getActivity<AppCompatActivity>().resources.getString(R.string.string_customer_version)+LKSystemUtil.checkVersionInfo()
   }


    /**
     * 设置标题栏
     */
    fun setTitle(title:String?){
        val jtb_accs= getView<SKTopBar>(R.id.jtb_accs)
        if (!TextUtils.isEmpty(title)){
            jtb_accs.setTitle(title)
        }
        setEvent(jtb_accs)
    }

    /**
     * 设置设置事件
     */
    fun setEvent(topBar: SKTopBar){
        topBar?.setEventInterface(object : SKTopBar.EventInterface{
            override fun leftOnClick() {
                getActivity<ContactCustomerServiceActivity>().finish()

            }
            override fun rightOnClick() {
            }

        })
    }

}